mudbox::ImageDescriptor Class Reference

#include <image.h>

Inheritance diagram for mudbox::ImageDescriptor:

Inheritance graph
[legend]
List of all members.

Detailed Description

Describe an image, specifically how to interpret pixel data.

This class derives from PixelDescriptor and adds a bounding rectangle and spatial resolution.


Public Types

enum   ResUnit { k_PixelsPerInch = 1, k_PixelsPerCentimeter = 2 }
  Resolution units (mainly used so resolution is preserved in PSD & TIFF files). More...

Public Member Functions

  ImageDescriptor (int x, int y, int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
  Constructor -- make a descriptor...
  ImageDescriptor (int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
  Constructor -- make a descriptor...
  ImageDescriptor ()
  default constructor -- RGBA, premult, 4 channel uChar, size 0 x 0 pixels.
int  numBytes () const
  return the number of bytes the raw image pixels will occupy -- not necessarily accurate for VirtualImages
int  strideBytes () const
  return the number of bytes wide that the image is
int  xSize () const
  return the x Size of the image
int  ySize () const
  return the y Size of the image
int  cSize () const
  return the channel count of the image
bool  sizeEqual (const ImageDescriptor &o) const
  return true if the x and y dimensions are equal
void  setSize (int nx, int ny)
  Set the size of the image in pixels.
const ImgTile getBounds () const
  return the bounds of the image
void  getResolutionInfo (float &xRes, float &yRes, ResUnit &unit) const
  return the horizontal and vertical resolution of the image
void  setResolutionInfo (float xRes, float yRes, ResUnit unit)
  set the horizontal and vertical resolution of the image

Protected Attributes

ImgTile  m_Bounds
  Bounds of the image -- some images may not have a 0,0 origin.
float  m_xResolution
  horizontal resolution in pixels per unit
float  m_yResolution
  vertical resolution in pixels per unit
ResUnit  m_ResolutionUnits
  units -- 1 == inch, 2 == centimeter (same as in PSD files)

Friends

class  Image

Member Enumeration Documentation

enum mudbox::ImageDescriptor::ResUnit
 

Resolution units (mainly used so resolution is preserved in PSD & TIFF files).

Enumeration values:
k_PixelsPerInch  pixels per inch
k_PixelsPerCentimeter  pixels per centimeter
01214                  { k_PixelsPerInch       = 1, 
01215                    k_PixelsPerCentimeter = 2  
01216     };

Constructor & Destructor Documentation

mudbox::ImageDescriptor::ImageDescriptor int  x,
int  y,
int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar
[inline]
 

Constructor -- make a descriptor...

Parameters:
x  x origin of the image
y  y origin of the image
nx  xSize of the image
ny  ySize of the image
order  channel ordering of the image
premult  Are the RGB channels premultiplied by the A?
nc  number of channels -- currently only 4 is supported
ct  data type of the channels -- currently only uChar is supported.
01242                                                          :
01243         PixelDescriptor(nc, ct, order, premult),
01244         m_Bounds(x, y, nx, ny),
01245         m_xResolution(100.0f), m_yResolution(100.0f),
01246         m_ResolutionUnits(k_PixelsPerInch) {}

mudbox::ImageDescriptor::ImageDescriptor int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar
[inline]
 

Constructor -- make a descriptor...

Parameters:
nx  xSize of the image
ny  ySize of the image
order  channel ordering of the image
premult  Are the RGB channels premultiplied by the A?
nc  number of channels -- currently only 4 is supported
ct  data type of the channels -- currently only uChar is supported.
01261                                                          :
01262         PixelDescriptor(nc, ct, order, premult),
01263         m_Bounds(0, 0, nx, ny) {}

mudbox::ImageDescriptor::ImageDescriptor  )  [inline]
 

default constructor -- RGBA, premult, 4 channel uChar, size 0 x 0 pixels.

01266                       :
01267         PixelDescriptor(4, uChar,  orderRGBA, true),
01268         m_Bounds(0,0,0,0) {}


Member Function Documentation

int mudbox::ImageDescriptor::numBytes  )  const [inline]
 

return the number of bytes the raw image pixels will occupy -- not necessarily accurate for VirtualImages

01272 { return m_Bounds.nx * m_Bounds.ny * pixelSize(); }
int mudbox::ImageDescriptor::strideBytes  )  const [inline]
 

return the number of bytes wide that the image is

01275 { return m_Bounds.nx * pixelSize(); }
int mudbox::ImageDescriptor::xSize  )  const [inline]
 

return the x Size of the image

01278 { return m_Bounds.nx;  }
int mudbox::ImageDescriptor::ySize  )  const [inline]
 

return the y Size of the image

01281 { return m_Bounds.ny;  }
int mudbox::ImageDescriptor::cSize  )  const [inline]
 

return the channel count of the image

01284 { return m_cCount; }
bool mudbox::ImageDescriptor::sizeEqual const ImageDescriptor o  )  const [inline]
 

return true if the x and y dimensions are equal

Parameters:
o  the other descriptor to compare against.
01290         { return ((xSize() == o.xSize()) && (ySize() == o.ySize())); }
void mudbox::ImageDescriptor::setSize int  nx,
int  ny
[inline]
 

Set the size of the image in pixels.

01293 { m_Bounds.nx = nx; m_Bounds.ny = ny; }
const ImgTile& mudbox::ImageDescriptor::getBounds  )  const [inline]
 

return the bounds of the image

01296 { return m_Bounds; }
void mudbox::ImageDescriptor::getResolutionInfo float &  xRes,
float &  yRes,
ResUnit unit
const [inline]
 

return the horizontal and vertical resolution of the image

Parameters:
xRes  returned X Resolution in Pixels per unit
yRes  returned y Resolution in Pixels per unit
unit  returned resolution unit
01305     {
01306         xRes = m_xResolution; yRes = m_yResolution, unit = m_ResolutionUnits;
01307     }
void mudbox::ImageDescriptor::setResolutionInfo float  xRes,
float  yRes,
ResUnit  unit
[inline]
 

set the horizontal and vertical resolution of the image

Parameters:
xRes  new X Resolution in Pixels per unit
yRes  new y Resolution in Pixels per unit
unit  new resolution unit
01316     {
01317         m_xResolution = xRes; m_yResolution = yRes, m_ResolutionUnits = unit;
01318     }

Friends And Related Function Documentation

friend class Image [friend]
 

Member Data Documentation

ImgTile mudbox::ImageDescriptor::m_Bounds [protected]
 

Bounds of the image -- some images may not have a 0,0 origin.

float mudbox::ImageDescriptor::m_xResolution [protected]
 

horizontal resolution in pixels per unit

float mudbox::ImageDescriptor::m_yResolution [protected]
 

vertical resolution in pixels per unit

ResUnit mudbox::ImageDescriptor::m_ResolutionUnits [protected]
 

units -- 1 == inch, 2 == centimeter (same as in PSD files)


mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor
mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor mudbox::ImageDescriptor